import request from '@/utils/request'

/**
 * 政企用户登录
 * @param {String} email email地址
 * @param {String} password 密码
 * @returns Object
 */
export function governmentEnterpriseLogin(email, password) {
  return request({
    url: '/User/governmentEnterpriseLogin',
    method: 'post',
    data: {
      email: email,
      password: password
    }
  })
}

/**
   * 个人用户登录
   * @param {Number} phoneNumber 手机号码
   * @param {Number} verificationCode 短信验证码
   * @returns Object
   */
export function personalLogin(phoneNumber, verificationCode) {
  return request({
    url: '/User/personalLogin',
    method: 'post',
    data: {
      phone_number: phoneNumber,
      verification_code: verificationCode
    }
  })
}

/**
 * email地址注册
 * @param {String} email email地址
 * @param {String} password 密码
 * @returns Object
 */
export function emailRegister(email, password) {
  return request({
    url: '/User/emailRegister',
    method: 'post',
    data: {
      email: email,
      password: password
    }
  })
}

/**
 * 退出
 * @returns Object
 */
export function logout() {
  return request({
    url: '/User/logout',
    method: 'get'
  })
}

/**
 * 获取用户信息
 * @returns Object
 */
export function getInfo() {
  return request({
    url: '/User/info',
    method: 'get'
  })
}
